"Db2: command not found" error when Db2 commands are run from command |
您所在的位置:网站首页 › nodejs command not found › "Db2: command not found" error when Db2 commands are run from command |
Problem
Sometimes users might encounter this error when trying to run any Db2 commands from the command line: Error: -bash: Db2: command not found CauseThis error might show up if your command-line environment is not set up properly. Environment All command-line environments. Diagnosing The ProblemRunning any Db2 commands like "Db2 connect to db", "Db2 list applications", "Db2 ..." and so on can lead to you getting the error: Error: -bash: Db2: command not found This error indicates a problem with your command-line environment setup and not within Db2. Resolving The ProblemHere are steps to follow for a certain user (profile) for the Db2 command line to work: IBM provides a profile (actually two of them) that contains all the information needed to connect and run any Db2 commands you might need. This profile is stored in the sqllib directory. This directory is created in the home directory of the instance owner when the Db2 instance is created. The following lines are added by Db2 to the .profile, .bash_profile, or .bashrc when the instance is created to source the db2profile: # The following three lines have been added by UDB DB2. if [ -f /db2home/db2inst1/sqllib/db2profile ]; then . /db2home/db2inst1/sqllib/db2profile fi The path specified in these lines is going to vary depending on where your instance owner’s home directory is. Generally, your instance owner’s home directory should not be on / or on /home. Hopefully you’ve placed it somewhere else. If you don’t know where the instance owner’s home directory is, there are several ways to find it. For any of them, you need to have access to the server in some way and know the name of the instance owner. If you don’t have this, ask your system admin or database administrator. There can easily be many Db2 instances on a server. In this example below, the instance name is represented by db2inst1. You want to replace that with your instance name. If you have access to the instance owner ID, login and issue: $echo $INSTHOME On the server, try the command: $cat /etc/passwd |grep db2inst1 Look at the instance owner's .profile, .bash_profile, and .bashrc to find the lines automatically added by Db2 on installation: Once you have the correct location, you can substitute it into the lines above in the .profile, .bash_profile, and/or the .bashrc of every user who wants to be able to execute Db2 commands: if [ -f /db2home/db2inst1/sqllib/db2profile ]; then . /db2home/db2inst1/sqllib/db2profile fi Hope you are able to set it for this user that gets the error. You can basically copy the same profile contents (path) the instance owner has to this user’s profile. Related InformationLinux and UNIX environment variable settings Document LocationWorldwide [{"Type":"MASTER","Line of Business":{"code":"LOB10","label":"Data and AI"},"Business Unit":{"code":"BU058","label":"IBM Infrastructure w\/TPS"},"Product":{"code":"SSEPGG","label":"Db2 for Linux, UNIX and Windows"},"ARM Category":[{"code":"a8m500000008PkiAAE","label":"Administrative Tools"},{"code":"a8m500000008Pm8AAE","label":"Install\/Migrate\/Upgrade->Command Line"}],"ARM Case Number":"","Platform":[{"code":"PF002","label":"AIX"},{"code":"PF010","label":"HP-UX"},{"code":"PF016","label":"Linux"},{"code":"PF027","label":"Solaris"}],"Version":"All Versions"}] |
CopyRight 2018-2019 办公设备维修网 版权所有 豫ICP备15022753号-3 |